package com.baosight.xCyber;

import com.baosight.hdsdk.HDConnectionFactory;
import com.baosight.hdsdk.HDServerFactory;
import com.baosight.hdsdk.domain.data.HDDataConnection;
import com.baosight.hdsdk.domain.data.HDDataServer;
import com.baosight.hdsdk.exception.HDSdkException;

import java.util.logging.Logger;

public class HDManagerDemo {
    private static Logger logger = Logger.getLogger(HDManagerDemo.class.getSimpleName());

    //获取IFDB数据库的连接
    public static HDDataConnection getConnection() {

        String serverIP = "10.25.25.129";
        logger.info("正在尝试连接" + serverIP);
        HDDataServer server = HDServerFactory.getHDDataServer(serverIP, 5673, null, 5673);
        HDDataConnection connection = null;
        try {
            connection = HDConnectionFactory.getHDDataConnection(server);
            connection.loginToServer("admin", "admin");
            logger.info("连接成功");
        } catch (HDSdkException e) {
            e.printStackTrace();
        }
        return connection;
    }
}
